#!/bin/python

#
#Xithyl, Test Driven Development for C
#Copyright (C) 2012  Stepan Henek
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import sys
import unittest

sys.path.append("..")

from xithyl.tests.libc import String 
from xithyl import logger

class StringTests(unittest.TestCase):
    """
    Test all functions in libc string.h
    """

    def test_functional(self):
        """
        Perfrom basic functional tests.
        (Just check required functionality.)
        """
        res = String.StartFunctional()
        msg = String.ErrorMsg()
        self.assertTrue(res, msg)

if __name__ == '__main__':

    # Create the tests
    test = StringTests
    suite = unittest.TestLoader().loadTestsFromTestCase(test)

    # Open logger
    f = open("/tmp/libcString.log", "a")
    logger.outs.append(f)
    logger.start()

    # Start the tests
    unittest.TextTestRunner(verbosity=2).run(suite)

    # Stop logging
    logger.stop()
